package com.source.barcodeMachineGrantAndRecovery.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.source.barcodeMachineGrantAndRecovery.VO.BarcodeMachineRevokeVO;
import com.source.barcodeMachineGrantAndRecovery.entity.BarcodeMachineRevoke;
import com.source.barcodeMachineGrantAndRecovery.mapper.BarcodeMachineRevokeMapper;
import com.source.barcodeMachineGrantAndRecovery.service.BarcodeMachineRevokeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Feng
 * @since 2021-02-24
 */

@Service
public class BarcodeMachineRevokeServiceImpl extends ServiceImpl<BarcodeMachineRevokeMapper, BarcodeMachineRevoke> implements BarcodeMachineRevokeService {

    @Resource
    BarcodeMachineRevokeMapper barcodeMachineRevokeMapper;

    @Override
    public BarcodeMachineRevokeVO find(int id) {
        return barcodeMachineRevokeMapper.getByRevokeId(id);
    }

    @Override
    public List<BarcodeMachineRevokeVO> find() {
        return barcodeMachineRevokeMapper.listAll();
    }

    @Override
    public Page<BarcodeMachineRevokeVO> find(int current, int size) {
        return barcodeMachineRevokeMapper.pageAll(new Page<>(current, size));
    }

    @Override
    public List<BarcodeMachineRevokeVO> findByBarcodeMachineNumber(int id) {
        return barcodeMachineRevokeMapper.listByBarcodeMachineNumber(id);
    }

    @Override
    public Page<BarcodeMachineRevokeVO> findByBarcodeMachineNumber(int id, int current, int size) {
        return barcodeMachineRevokeMapper.pageByBarcodeMachineNumber(id, new Page<>(current, size));
    }

    @Override
    public List<BarcodeMachineRevokeVO> like(String str) {
        return barcodeMachineRevokeMapper.listLike(str);
    }

    @Override
    public Page<BarcodeMachineRevokeVO> like(String str, int current, int size) {
        return barcodeMachineRevokeMapper.pageLike(str, new Page<>(current, size));
    }

    @Override
    public boolean remove(String ids) {
        return removeByIds(Arrays.asList(ids.split(",")));
    }

}
